(define (lifetime-analysis use)
  (let loop ((i 0) (use use) (births '()) (deaths '()))
    (if (null? use)
	(list (reverse births) deaths)
	(let ((uses (cdar use)))
	  (loop (+ i 1)
		(cdr use)
		(cons (cons (caar use) i) births)
		(assoc-replace* (map (lambda (var) (cons var i)) uses) deaths))))))

(define (interference-graph use)
  (let ((lifes (lifetime-analysis use)))
    (let loop ((i 0)
	       (births (sort-by (comparing < cdr) (car lifes)))
	       (deaths (sort-by (comparing < cdr) (cadr lifes)))
	       (current '()))
      ;; remove from current by the deaths
      ;; add to current from the births
      ;; add the edges relating to anything that was added
      ;; continue
      
